
const news = require('./mock/match/NewsKeywordsList.json')
const match = require('./mock/match/allMatchpage1.json')
const hotmatchdata = require('./mock/match/hotMatch.json')
const buyticket = require('./mock/match/buyMatch.json')
const commentary = require('./mock/match/matchnarratorlist.json')
const introduction = require('./mock/match/matchrefereelist.json')
const teaminfo = require('./mock/match/matchteaminfo8.json')
const scoredata = require('./mock/match/match_score.json')
// 百态 mx
const story = require('./mock/Baitai/story.json')
const muhou = require('./mock/Baitai/muhou.json')
// 主页 mql
const list1 = require('./mock/mql/mql-list1.json')
const contentcenter = require('./mock/mql/content-center.json')

const videodata = require('./mock/match/videolist.json')
const data = require('./mock/herolist/herolist.json')
const item = require('./mock/itemlist/item.json')
const summoner = require('./mock/summoner/summoner.json')
const item2 = require('./mock/itemlist/item2.json')
const hero = require('./mock/video/hero.json')
const tab = require('./mock/video/tab.json')
const like = require('./mock/video/like.json')
const test = require('./mock/mql/mql-test1.json')

// wh
const WHlunbo = require('./mock/ithao/lunbo.json')
const whherolists = require('./mock/ithao/herolists.json')
const WHheroxq = require(`./mock/ithao/heroxq.json`)
const WHjingpinlistxq = require('./mock/ithao/jingpinxq.json')
const WHjingpinlists = require('./mock/ithao/jingpinlist.json')
const WHhearLogo = require('./mock/ithao/hearLogo.json')
const WHherolist = require('./mock/ithao/herolist.json')
const WHherolists = require('./mock/ithao/moreHerolist.json')
const WHsummoners = require('./mock/ithao/summoner.json')
const WHgetdaojulists = require('./mock/ithao/item.json')
module.exports = {
  devServer: {
    before (app) {
      app.get('/getdata', (req, res) => {
        res.send(data)
      })
      app.get('/getitem', (req, res) => {
        res.send(item)
      })
      app.get('/getsummoner', (req, res) => {
        res.send(summoner)
      })
      app.get('/getitem2', (req, res) => {
        res.send(item2)
      })
      app.get('/gettest', (req, res) => {
        res.send(test)
      })
      app.get('/getlunbo', (req, res) => {
        res.send(WHlunbo)
      })
      app.get('/herolist', (req, res) => {
        res.send(whherolists)
      })
      app.get('/getheroxq', (req, res) => {
        res.send(WHheroxq)
      })
      app.get('/getjingpinxq', (req, res) => {
        res.send(WHjingpinlistxq)
      })
      app.get('/getjingpin', (req, res) => {
        res.send(WHjingpinlists)
      })
      app.get('/gethearLogo', (req, res) => {
        res.send(WHhearLogo)
      })
      app.get('/getherolist', (req, res) => {
        res.send(WHherolist)
      })
      app.get('/getherolists', (req, res) => {
        res.send(WHherolists)
      })
      app.get('/WHgetsummoners', (req, res) => {
        res.send(WHsummoners)
      })
      app.get('/WHgetdaojulists', (req, res) => {
        res.send(WHgetdaojulists)
      })
      // 新闻
      app.get('/match/newsdata', (req, res) => {
        res.send(news)
      })
      // 全部比赛
      app.get('/match/matchdata', (req, res) => {
        res.send(match)
      })
      // 热门比赛
      app.get('/match/hotmatchdata', (req, res) => {
        res.send(hotmatchdata)
      })
      // 购票
      app.get('/match/buyticketdata', (req, res) => {
        res.send(buyticket)
      })
      // 百态cmx
      app.get('/getstory', (req, res) => {
        res.send(story)
      })
      app.get('/getmuhou', (req, res) => {
        res.send(muhou)
      })
      // 主页 mql
      app.get('/getlist1', (req, res) => {
        res.send(list1)
      })
      app.get('/centercon', (req, res) => {
        res.send(contentcenter)
      })
      // 解说
      app.get('/match/commdata', (req, res) => {
        res.send(commentary)
        // console.log(commentary)
      })
      // 裁判
      app.get('/match/introdata', (req, res) => {
        res.send(introduction)
        // console.log(introduction)
      })
      // 队伍
      app.get('/match/teamdata', (req, res) => {
        res.send(teaminfo)
        // console.log(teaminfo)
      })
      // 比分
      app.get('/match/scoredata', (req, res) => {
        res.send(scoredata)
        // console.log(scoredata)
      })
      // 视频数据
      app.get('/match/videodata', (req, res) => {
        res.send(videodata)
        // console.log(videodata)
      })
      app.get('/gethero', (req, res) => {
        res.send(hero)
      })
      app.get('/gettab', (req, res) => {
        res.send(tab)
      })
      app.get('/getlike', (req, res) => {
        res.send(like)
      })
    }
  },
  chainWebpack: config => {
    // 发布模式
    config.when(process.env.NODE_ENV === 'production', config => {
      // 配置入口文件
      config
        .entry('app')
        .clear()
        .add('./src/main-prod.js')
      // 配置CDN
      config
        .set('externals', {
          vue: 'Vue',
          'vue-router': 'VueRouter',
          axios: 'axios',
          // ' element-ui': 'ElementUI'
          'element-ui': 'ElementUI'
        })
      // 配置首页定制
      config.plugin('html').tap(args => {
        args[0].isProd = true
        return args
      })
    })
    // 开发模式
    config.when(process.env.NODE_ENV === 'development', config => {
      config
        .entry('app')
        .clear()
        .add('./src/main-dev.js')
      // 配置首页定制
      config.plugin('html').tap(args => {
        args[0].isProd = false
        return args
      })
    })
  }
}
